package com.tuvi.nhamthin.dialog;

import com.tuvi.nhamthin.R;
import com.tuvi.nhamthin.activity.Active;
import com.tuvi.nhamthin.activity.Giap;

import android.app.Dialog;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.telephony.gsm.SmsManager;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.Toast;

public class ActiveDialog extends Dialog implements android.view.View.OnClickListener{

    /** Dialog context */
    private Context mContext;
    private Button btnCancel;
    private Button btnOk;
	public ActiveDialog(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	     requestWindowFeature(Window.FEATURE_NO_TITLE);
		 mContext = context;
		 this.setContentView(R.layout.active_dialog);
		 btnCancel = (Button)findViewById(R.id.btn_cancel);
		 btnOk = (Button)findViewById(R.id.btn_ok);
		 btnCancel.setOnClickListener(this);
		 btnOk.setOnClickListener(this);
	}
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v == btnCancel){ 
			this.dismiss();
		} else if (v == btnOk) {
			//Send SMS
			 sendSMS();
			 Toast.makeText(mContext, R.string.sms_sent, Toast.LENGTH_LONG).show();
             dismiss();
		} 
		
	}
    public void sendSMS() {
    	PendingIntent pi1 = PendingIntent.getActivity(mContext, 0, new Intent(mContext, ActiveDialog.class), 0);
        SmsManager sms = SmsManager.getDefault();
        sms.sendTextMessage("8777", null, "ACT TV", pi1, null);        
    }
	
	
	
	
}
